package com.example.myapplication;

import androidx.annotation.StringRes;
 public  class Question {

    @StringRes
    private int textResId;
    private Boolean answer;

    // 构造函数
    public Question(int textResId, Boolean answer) {
        this.textResId = textResId;
        this.answer = answer;
    }

    // Getter for textResId
    public int getTextResId() {
        return textResId;
    }

    // Setter for textResId
    public void setTextResId(int textResId) {
        this.textResId = textResId;
    }

    // Getter for answer
    public Boolean isAnswer() {
        return answer;
    }

    // Setter for answer
    public void setAnswer(boolean answer) {
        this.answer = answer;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;

        Question question = (Question) o;

        if (textResId != question.textResId) return false;
        return answer == question.answer;
    }

    @Override
    public int hashCode() {
        int result = textResId;
        result = 31 * result + (answer ? 1 : 0);
        return result;
    }

    @Override
    public String toString() {
        return "Question{" +
                "textResId=" + textResId +
                ", answer=" + answer +
                '}';
    }
}